import { createRouter, createWebHashHistory } from 'vue-router'

// 路由器
const routes = [
    {
        path: '/',
        name: 'login',
        meta: { title: '登录页面' },
        component: () => import('../views/login.vue')
    },
    {
        path: '/index',
        name: 'index',
        component: () => import('../layout/index.vue'),
        children: [
            {
                path: '',
                name: 'index',
                component: () => import('../views/index.vue')
            },
            {
                // 轮播图
                path: '/lideshow',
                name: 'lideshow',
                component: () => import('../views/carousel/lideshow.vue')
            },
            {
                // 医院管理
                path: '/listHospital',
                name: 'listHospital',
                component: () => import('../views/hospital/index.vue')
            },
            {
                // 地图
                path: '/map',
                name: 'map',
                component: () => import('../views/hospital/Map.vue')
            },
            {
                // 医生管理
                path: '/listDoctor',
                name: 'listDoctor',
                component: () => import('../views/doctors/index.vue'),
            },
            {
                // 医院详情科室
                path: '/showDep/:id/:name',
                name: 'showDep',
                component: () => import('../views/hospital/showDep.vue')
            },

            {
                // 科室
                path: '/listDepartment',
                name: 'listDepartment',
                component: () => import('../views/department/index.vue')
            },
            {
                // 科室详情医生
                path: '/showDepDoc/:id/:name/:hospitalName',
                name: 'showDepDoc',
                component: () => import('../views/department/showDepDoc.vue')
            },
            {
                // 医院科室详情医生
                path: '/showDoc/:id/:name/:hospitalId/:hospitalName',
                name: 'showDoc',
                component: () => import('../views/department/showDoc.vue')
            },
            {
                // 地图
                path: '/form',
                name: 'form',
                component: () => import('../views/hospital/form.vue')
            },
            //科室医生详情
            {
                path: '/showDepDocAll/:id/:depName/:hospitalName',
                name: 'showDepDocAll',
                component: () => import('../views/doctors/showDepDocAll.vue')
            },
            //医院科室医生详情
            {
                path: '/showDocAll/:id/:depName/:hospitalName',
                name: 'showDocAll',
                component: () => import('../views/doctors/showDocAll.vue')
            },
            {
                path: '/showxx/:id',
                name: 'showxx',
                component: () => import('../views/doctors/show.vue')
            },
            {
                // 患者管理
                path: '/listPatient',
                name: 'listPatient',
                component: () => import('../views/patient/index.vue')
            },
            {
                // 药品管理
                path: '/listMedicine',
                name: 'listMedicine',
                component: () => import('../views/medicine/MedicineList.vue')
            },
            {
                // 库存管理
                path: '/medicineStock',
                name: 'medicineStock',
                component: () => import('../views/stock/StockList.vue')
            }
        ]
    }
]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router
